define(()=>{
    class IsLogin{
        constructor(){
            this.user_img =document.querySelector('.userXX img');
            this.user_name = document.querySelector('.userXX span');
            this.hello1 = document.querySelector('#header .hello1');
            this.pla = document.querySelector('.pla');
            this.username1 = document.querySelector('.username1');
            this.exit1 = document.querySelector('.exit');
            this.flag = null;
            this.is_login();
            this.go_login();
            this.exit();
        }
        go_login(){
            this.pla.onclick = ()=>{
                location.href = 'http://localhost:2206/login.html'
            }
        }
        is_login(){
            this.user = JSON.parse(localStorage.getItem('login'))||[];

            console.log(this.user.length)
            if(this.user.length){
                this.user_img.src = '../libs/images/user_l.webp';
                this.hello1.style.display = `none`
                this.username1.style.display = 'block'
                this.username1.innerHTML = `hi,${this.user[0].username}`;
                this.user_name.innerHTML = this.user[0].username;
                this.pla.style.display = 'none'
                this.exit1.style.display = 'block'
                
            }else{
                this.user_img.src = '../libs/images/user_i.webp';
                this.hello1.style.display = `block`
                this.username1.style.display = 'none'
                this.user_name.innerHTML = '亲，可以登录哦';
                this.pla.style.display = 'block'
                this.exit1.style.display = 'none'
            }
        }
        exit(){
            this.exit1.onclick = ()=>{
                localStorage.removeItem('login');

                this.is_login();
                console.log(111);
            }
        }
    }
    new IsLogin
});